<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加宿舍信息</title>
    <link rel="stylesheet" href="/css/layui.css">
</head>
<body>

<!-- 新增界面 -->
<form class="layui-form" id="TeacherAddStuDormitory" lay-filter="TeacherAddStuDormitoryFilter">
        <div class="layui-form-item">
            <label class="layui-form-label">宿舍名称</label>
            <div class="layui-input-inline">
                <select name="dormitoryName">
                    <option value="">请选择宿舍</option>
                    <option value="101">101</option>
                    <option value="201">201</option>
                    <option value="301">301</option>
                </select>
            </div>
            <label class="layui-form-label">学生学号</label>
            <div class="layui-input-inline">
                <input type="text" name="studentId"  autocomplete="off" placeholder="请输入学号" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">负责老师</label>
            <div class="layui-input-inline">
                <select name="teacherId">
                    <option value="">请选择科目老师</option>
                    <option value="1">文章</option>
                    <option value="3">数学王者</option>
                    <option value="4">物理大神</option>
                    <option value="5">化学牛人</option>
                    <option value="7">生物教授</option>
                    <option value="9">历史时钟</option>
                    <option value="10">政治角斗士</option>
                    <option value="13">地理游客</option>
                    <option value="15">体育达人</option>
                    <option value="16">英语健将</option>
                    <option value="17">杂家</option>
                    <option value="19">全才</option>
                </select>
            </div>
            <label class="layui-form-label">卫生得分</label>
            <div class="layui-input-inline">
                <input type="text" name="hygieneScore"  placeholder="请输入分数" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">荣誉</label>
            <div class="layui-input-block">
                <textarea placeholder="请输入获得的荣誉" name="honor" class="layui-textarea"></textarea>
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">维修记录</label>
            <div class="layui-input-block">
                <textarea placeholder="请输入维修记录" name="repairRecord" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item" style="text-align: center">
            <button  class="layui-btn" lay-submit lay-filter="doSubmit">新增</button>
            <input type="reset" class="layui-btn" value="重置">
        </div>
</form>

</body>
<script src="/layui.js" charset="utf-8"></script>
<script src="/js/jquery-1.8.3.js"></script>
<script>
    layui.use(["form","layer"],function () {
        let form=layui.form;
        let layer=layui.layer;

        form.on("submit(doSubmit)",function (data) {
            $.post("/teacher/addStuDormitory",data.field,function (res) {
                if (res.success=="true"){
                    layer.alert("新增成功！",{icon:6,time:2000});
                    setTimeout(function () {
                        layer.closeAll();
                    }, 1000*1.5)
                } else {
                    layer.alert(res.msg,{icon:5,time:2000})
                }

            });
            return false;
        })

    })
</script>
</html>